package sets;

import java.util.List;
import java.util.Map;

import memberships.MembershipFunction;
import universe.IUniverseOfDiscourse;
import utils.Element;
import utils.Interval;

public class IntervalFuzzySet1 implements IFuzzySet {

	private FuzzySetType1 lowerSet;
	private FuzzySetType1 upperSet;
	
	private String column;
	private IUniverseOfDiscourse universe;
	private IFuzzySet.Type type;
	
	public IntervalFuzzySet1() {
		type = IFuzzySet.Type.INTERVAL;
	}
	
	
	@Override
	public Boolean isEmpty() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Boolean isConcave() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Boolean isConvex() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Boolean isNormal() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ClassicalSet supp() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval sup() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval card() {
		Interval interval = new Interval();
		interval.setX(lowerSet.card().toDouble());
		interval.setY(upperSet.card().toDouble());
		return interval;
	}
	@Override
	public Interval in() {
		Interval interval = new Interval();
		interval.setX(lowerSet.in().toDouble());
		interval.setY(upperSet.in().toDouble());
		return interval;
	}
	@Override
	public Interval c() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval hgt() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ClassicalSet core() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ClassicalSet alphaCut(double alpha) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public IFuzzySet union(IFuzzySet set) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public IFuzzySet intersection(IFuzzySet set) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public IFuzzySet complement(IFuzzySet set) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void setMembershipFunction(MembershipFunction membershipFunction) {
		lowerSet.setMembershipFunction(membershipFunction);
		upperSet.setMembershipFunction(membershipFunction);
	}
	
	@Override
	public MembershipFunction getMembershipFunction() {
		throw new UnsupportedOperationException("Interval-Valued Fuzzy Set has two membership functions!");
	}
	
	@Override
	public void setUniverseOfDiscorse(IUniverseOfDiscourse universe) {
		this.universe = universe;
		if (lowerSet != null) {
			lowerSet.setUniverseOfDiscorse(universe);
		}
		if (upperSet != null) {
			upperSet.setUniverseOfDiscorse(universe);
		}
	}
	
	@Override
	public IUniverseOfDiscourse getUniverseOfDiscorse() {
		return universe;
	}
	
	@Override
	public void setElements(List<Element> elements) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public List<Element> getElements() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void addElement(Double element) {
		lowerSet.addElement(element);
		upperSet.addElement(element);
	}
	
	@Override
	public void setColumn(String column) {
		this.column = column;
	}
	
	@Override
	public String getColumn() {
		return column;
	}
	
	@Override
	public Map<Double, Double> getElementsAsMap() {
		// TODO Auto-generated method stub
		return null;
	}
	
	
	
	
	@Override
	public void setLowerFuzzySet(FuzzySetType1 lowerSet) {	// for compability with interface only!
		this.lowerSet = lowerSet;
		if (universe != null) {
			this.lowerSet.setUniverseOfDiscorse(universe);
		}
	}

	@Override
	public void setUpperFuzzySet(FuzzySetType1 upperSet) {	// for compability with interface only!
		this.upperSet = upperSet;
		if (universe != null) {
			this.upperSet.setUniverseOfDiscorse(universe);
		}
	}
	@Override
	public MembershipFunction getLowerMembershipFunction() {
		return lowerSet.getMembershipFunction();
	}
	@Override
	public MembershipFunction getUpperMembershipFunction() {
		return upperSet.getMembershipFunction();
	}

	@Override
	public Type getType() {
		return type;
	}
	
	public IFuzzySet getLowerSet() {
		return lowerSet;
	}
	
	public IFuzzySet getUpperSet() {
		return upperSet;
	}


	@Override
	public void clearElements() {
		lowerSet.clearElements();
		upperSet.clearElements();
	}
}
